package com.production.CoursePlatform.mapper;

import com.production.CoursePlatform.entity.Course;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface CourseMapper {
    @Select("SELECT c.* FROM course c INNER JOIN teaching t ON c.c_id = t.c_id AND c.c_number = t.c_number WHERE t.t_id = #{tID}")
    public List<Course> findCoursesByTeacher(String tID);

    // 根据学生ID获取学生参与的课程
    @Select("SELECT c.* FROM course c " +
            "INNER JOIN teaching t ON c.c_id = t.c_id AND c.c_number = t.c_number " +
            "INNER JOIN studying s ON s.ct_id = t.ct_id " +
            "WHERE s.s_id = #{sID}")
    public List<Course> findCoursesByStudent(String sID);
}

